part of '../controller.dart';

class _OrderPlacingResultDtoFactory {
  const _OrderPlacingResultDtoFactory._internal();

  static const _instance = _OrderPlacingResultDtoFactory._internal();

  factory _OrderPlacingResultDtoFactory() {
    return _instance;
  }

  _OrderPlacingResultDto fromEntity(YookassaOrderPlacingResult orderPlacingResult) {
    if (orderPlacingResult is PendingYookassaOrderPlacingResult) {
      return _PendingOrderPlacingResultDto.fromEntity(orderPlacingResult);
    }

    if (orderPlacingResult is SucceededYookassaOrderPlacingResult) {
      return const _SucceededOrderPlacingResultDto();
    }

    throw UnimplementedError();
  }
}
